package ai.people.netmon;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


/**
 * @description: Telegram服务启动类
 * @author: Xing.Wei
 * @time: 2020-09-02 11:21
 */
//@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) // 开启认证服务，扫描 PreAuthorize
@MapperScan("ai.people.netmon.telegram.mapper") // mybatis扫描的Mapper包
@EnableFeignClients("ai.people.core.feign.api")
//@ComponentScan(basePackages = {"ai.people.netmon"}) // 扫描接口
@SpringBootApplication
public class TelegramServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(TelegramServiceApplication.class, args);
    }

    /**
     * 创建RestTemplate并注入Spring容器
     */
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

}
